<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:o="http://openfaces.org/"
	xmlns:s="http://jboss.com/products/seam/taglib"
	template="/WEB-INF/esquema/plantillasimple.xhtml">

	<ui:define name="body">
		<ui:decorate template="/WEB-INF/esquema/permitTemplate.xhtml">
			<ui:define name="mainControls">
				<h:outputText value="Opciones" />
				<h:outputText value="     " />
				<h:panelGroup>
					<h:form>
						<a4j:commandButton value="#{messages['approval.btn.applychanges']}" oncomplete="#{rich:component('strict-confirmation-dialog')}.show()">
							<f:setPropertyActionListener target="#{dialogHelper.confirmMsg}" value="#{messages['permit.approve_permit_msg']}"/>
							<f:setPropertyActionListener target="#{dialogHelper.jsFunction}" value="applychanges();"/>
						</a4j:commandButton>
						<a4j:commandButton value="#{messages['approval.btn.denychanges']}" oncomplete="#{rich:component('strict-confirmation-dialog')}.show()">
							<f:setPropertyActionListener target="#{dialogHelper.confirmMsg}" value="#{messages['permit.deny_permit_msg']}"/>
							<f:setPropertyActionListener target="#{dialogHelper.jsFunction}" value="denychanges();"/>
						</a4j:commandButton>
						<o:commandButton value="#{messages['button.l8r']}" onclick="pause();" type="button" />
					</h:form>
				</h:panelGroup>
			</ui:define>
			
			<ui:define name="extraControls">
				<h:form>
					<a4j:commandButton value="#{messages['options.view_request']}" reRender="transactionData"
					oncomplete="#{rich:component('viewRequestPanel')}.show()"
					rendered="#{view.viewId != '/workflow/transaction/approval.xhtml'}">
						<f:setPropertyActionListener value="#{true}" target="#{viewTransactionHelper.renderTransactionData}" />
					</a4j:commandButton>
					
					<a4j:commandButton value="#{messages['intro2.attacheddocs']}"
					oncomplete="#{rich:component('attachedFilesDlg')}.show()">
					</a4j:commandButton>
				</h:form>
			</ui:define>

			<ui:define name="title">
				<div align="center">
					<br /> <strong>#{messages['operation_permit.start_header']}</strong>
					<rich:separator lineType="solid" />
					<br /> <strong>#{messages['operation_permit.approval']}</strong>
					<rich:separator lineType="solid" />
					<br /> <br />
				</div>
			</ui:define>

			<ui:define name="permitBody">
				<h:form>
					<style type="text/css">
						.introCol1 {
							vertical-align: top;
							width: 30%;
						}
						
						.introCol2 {
							vertical-align: top;
							width: 70%;
						}
					</style>

					<div align="center">
					</div>

					<a4j:jsFunction name="applychanges" action="#{buildingPermitHelper.endApprovalTask}">
						<f:setPropertyActionListener target="#{buildingPermitHelper.approveTransaction}" value="#{true}"/>
					</a4j:jsFunction>
					<a4j:jsFunction name="denychanges" action="#{buildingPermitHelper.endApprovalTask}">
						<f:setPropertyActionListener target="#{buildingPermitHelper.approveTransaction}" value="#{false}"/>
					</a4j:jsFunction>
					<a4j:jsFunction name="pause" action="home" />
				</h:form>
			</ui:define>
		</ui:decorate>
	</ui:define>
</ui:composition>
